import React from "react"
import useUpdate from "../../hooks/useUpdate.ts"
import { useEffect, useState } from "react"

const TryUseUpdate = () => {
  const update = useUpdate()
  const [aNumber] = useState(-1)

  const handleClick = () => {
    // setANumber(Math.floor(Math.random() * 100))
    update()
  }

  useEffect(() => {
    console.log("组件重新渲染了")
  })

  return (
    <div>
      <h1>TryUseUpdate</h1>
      <div>{aNumber}</div>
      <button onClick={handleClick}>update</button>
    </div>
  )
}

export default TryUseUpdate
